home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 5 / Example 5.10 / camera.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-06-29  |  1019 b   |  44 lines

  1. #ifndef _CAMERA
  2. #define _CAMERA
  3.  
  4. #include <d3dx9.h>
  5. #include "mouse.h"
  6. #include "debug.h"
  7.  
  8. class CAMERA{
  9.     friend class APPLICATION;
  10.     friend class OBJECT;
  11.     public:
  12.         //Init Camera
  13.         CAMERA();
  14.         void Init(IDirect3DDevice9* Dev);
  15.  
  16.         //Movement
  17.         void Scroll(D3DXVECTOR3 vec);    //Move Focus
  18.         void Pitch(float f);            //Change B-angle
  19.         void Yaw(float f);                //Change A-angle
  20.         void Zoom(float f);                //Change FOV
  21.         void ChangeRadius(float f);        //Change Radius... douh
  22.  
  23.         //Calculate Eye position etc
  24.         void Update(MOUSE &mouse, TERRAIN &terrain, float timeDelta);
  25.         void CalculateFrustum(D3DXMATRIX view, D3DXMATRIX projection);
  26.         bool Cull(BBOX bBox);
  27.         bool Cull(BSPHERE bSphere);
  28.  
  29.         //Calculate Matrices
  30.         D3DXMATRIX GetViewMatrix();
  31.         D3DXMATRIX GetProjectionMatrix();
  32.  
  33.     private:
  34.  
  35.         IDirect3DDevice9* m_pDevice;
  36.         float m_alpha, m_beta, m_radius, m_fov;
  37.         D3DXVECTOR3 m_eye, m_focus, m_right, m_look;
  38.  
  39.         //6-planes to store our view frustum
  40.         D3DXPLANE m_frustum[6];
  41. };
  42.  
  43. #endif
  44.